<!DOCTYPE html>
<html lang="en-US">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="language" content="en" />
        <link href="./assets/ffd55088/css/bootstrap.css" rel="stylesheet">
<link href="./assets/5cf9384a/solarized_light.css" rel="stylesheet">
<link href="./assets/6c54116e/style.css" rel="stylesheet">
<script src="./assets/a44cef0f/jquery.js"></script>
<script src="./assets/ffd55088/js/bootstrap.js"></script>
<script src="./assets/8ac4e28a/jssearch.js"></script>    <title>ActiveRecord, yii\elasticsearch\ActiveRecord - Yii Framework 2.0 API Documentation</title>
</head>
<body>

<div class="wrap">
    <nav id="w11625" class="navbar-inverse navbar-fixed-top navbar" role="navigation"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w11625-collapse"><span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span></button><a class="navbar-brand" href="./index.html">Yii Framework 2.0 API Documentation</a></div><div id="w11625-collapse" class="collapse navbar-collapse"><ul id="w11626" class="navbar-nav nav"><li><a href="./index.html">Class reference</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Extensions <b class="caret"></b></a><ul id="w11627" class="dropdown-menu"><li><a href="./ext-apidoc-index.html" tabindex="-1">apidoc</a></li>
<li><a href="./ext-authclient-index.html" tabindex="-1">authclient</a></li>
<li><a href="./ext-bootstrap-index.html" tabindex="-1">bootstrap</a></li>
<li><a href="./ext-codeception-index.html" tabindex="-1">codeception</a></li>
<li><a href="./ext-debug-index.html" tabindex="-1">debug</a></li>
<li><a href="./ext-elasticsearch-index.html" tabindex="-1">elasticsearch</a></li>
<li><a href="./ext-faker-index.html" tabindex="-1">faker</a></li>
<li><a href="./ext-gii-index.html" tabindex="-1">gii</a></li>
<li><a href="./ext-imagine-index.html" tabindex="-1">imagine</a></li>
<li><a href="./ext-jui-index.html" tabindex="-1">jui</a></li>
<li><a href="./ext-mongodb-index.html" tabindex="-1">mongodb</a></li>
<li><a href="./ext-redis-index.html" tabindex="-1">redis</a></li>
<li><a href="./ext-smarty-index.html" tabindex="-1">smarty</a></li>
<li><a href="./ext-sphinx-index.html" tabindex="-1">sphinx</a></li>
<li><a href="./ext-swiftmailer-index.html" tabindex="-1">swiftmailer</a></li>
<li><a href="./ext-twig-index.html" tabindex="-1">twig</a></li></ul></li>
<li><a href="./guide-README.html">Guide</a></li></ul><div class="navbar-form navbar-left" role="search">
  <div class="form-group">
    <input id="searchbox" type="text" class="form-control" placeholder="Search">
  </div>
</div>
</div></nav>
    <div id="search-resultbox" style="display: none;" class="modal-content">
        <ul id="search-results">
        </ul>
    </div>

    
<div class="row">
    <div class="col-md-3">
                <div id="navigation" class="list-group"><a class="list-group-item active" href="#navigation-11624" data-toggle="collapse" data-parent="#navigation">yii\elasticsearch <b class="caret"></b></a><div id="navigation-11624" class="submenu panel-collapse collapse in"><a class="list-group-item" href="./yii-elasticsearch-activedataprovider.html">ActiveDataProvider</a>
<a class="list-group-item" href="./yii-elasticsearch-activefixture.html">ActiveFixture</a>
<a class="list-group-item" href="./yii-elasticsearch-activequery.html">ActiveQuery</a>
<a class="list-group-item active" href="./yii-elasticsearch-activerecord.html">ActiveRecord</a>
<a class="list-group-item" href="./yii-elasticsearch-batchqueryresult.html">BatchQueryResult</a>
<a class="list-group-item" href="./yii-elasticsearch-bulkcommand.html">BulkCommand</a>
<a class="list-group-item" href="./yii-elasticsearch-command.html">Command</a>
<a class="list-group-item" href="./yii-elasticsearch-connection.html">Connection</a>
<a class="list-group-item" href="./yii-elasticsearch-debugaction.html">DebugAction</a>
<a class="list-group-item" href="./yii-elasticsearch-debugpanel.html">DebugPanel</a>
<a class="list-group-item" href="./yii-elasticsearch-exception.html">Exception</a>
<a class="list-group-item" href="./yii-elasticsearch-query.html">Query</a>
<a class="list-group-item" href="./yii-elasticsearch-querybuilder.html">QueryBuilder</a></div></div>    </div>
    <div class="col-md-9 api-content" role="main">
        <h1>Class yii\elasticsearch\ActiveRecord</h1>
<div class="top-nav">
    <a href="index.html">All Classes</a>
            | <a href="#properties">Properties</a>
                | <a href="#methods">Methods</a>
                | <a href="#events">Events</a>
                | <a href="#constants">Constants</a>
    </div>

<table class="summaryTable docClass table table-bordered">
    <colgroup>
        <col class="col-name" />
        <col class="col-value" />
    </colgroup>
            <tr><th>Inheritance</th><td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a> &raquo;
<a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a> &raquo;
<a href="yii-base-model.html">yii\base\Model</a> &raquo;
<a href="yii-base-component.html">yii\base\Component</a> &raquo;
<a href="yii-base-object.html">yii\base\Object</a></td></tr>
                <tr><th>Implements</th><td><a href="http://www.php.net/class.arrayaccess">ArrayAccess</a>, <a href="http://www.php.net/class.iteratoraggregate">IteratorAggregate</a>, <a href="yii-base-arrayable.html">yii\base\Arrayable</a>, <a href="yii-base-configurable.html">yii\base\Configurable</a>, <a href="yii-db-activerecordinterface.html">yii\db\ActiveRecordInterface</a></td></tr>
                    <tr><th>Uses Traits</th><td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td></tr>
                            <tr><th>Available since version</th><td>2.0</td></tr>
                    <tr>
          <th>Source Code</th>
          <td><a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php">https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php</a></td>
        </tr>
    </table>

<div class="class-description">
    <p><strong>ActiveRecord is the base class for classes representing relational data in terms of objects.</strong></p>
    <p>This class implements the ActiveRecord pattern for the fulltext search and data storage
<a href="https://www.elastic.co/products/elasticsearch">elasticsearch</a>.</p>
<p>For defining a record a subclass should at least implement the <a href="yii-elasticsearch-activerecord.html#attributes()-detail">attributes()</a> method to define
attributes.
The primary key (the <code>_id</code> field in elasticsearch terms) is represented by <code>getId()</code> and <code>setId()</code>.
The primary key is not part of the attributes.</p>
<p>The following is an example model called <code>Customer</code>:</p>
<pre><code class="hljs php language-php"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Customer</span> <span class="hljs-keyword">extends</span> \<span class="hljs-title">yii</span>\<span class="hljs-title">elasticsearch</span>\<span class="hljs-title">ActiveRecord</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">attributes</span><span class="hljs-params">()</span>
    </span>{
        <span class="hljs-keyword">return</span> [<span class="hljs-string">'id'</span>, <span class="hljs-string">'name'</span>, <span class="hljs-string">'address'</span>, <span class="hljs-string">'registration_date'</span>];
    }
}
</code></pre>
<p>You may override <a href="yii-elasticsearch-activerecord.html#index()-detail">index()</a> and <a href="yii-elasticsearch-activerecord.html#type()-detail">type()</a> to define the index and type this record represents.</p>

    </div>

<a id="properties"></a>

<div class="summary doc-property">
<h2>Public Properties</h2>

<p><a href="#" class="toggle">Hide inherited properties</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-property" />
    <col class="col-type" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Property</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
        <tr class="inherited" id="$activeValidators">
        <td><a href="yii-base-model.html#$activeValidators-detail">$activeValidators</a></td>
        <td><a href="yii-validators-validator.html">yii\validators\Validator</a>[]</td>
        <td>The validators applicable to the current <a href="yii-base-model.html#$scenario-detail">$scenario</a>.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$attributes">
        <td><a href="yii-base-model.html#$attributes-detail">$attributes</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>Attribute values (name =&gt; value).</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$behaviors">
        <td><a href="yii-base-component.html#$behaviors-detail">$behaviors</a></td>
        <td><a href="yii-base-behavior.html">yii\base\Behavior</a>[]</td>
        <td>List of behaviors attached to this component</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="$dirtyAttributes">
        <td><a href="yii-db-baseactiverecord.html#$dirtyAttributes-detail">$dirtyAttributes</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>The changed attribute values (name-value pairs)</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$errors">
        <td><a href="yii-base-model.html#$errors-detail">$errors</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>Errors for all attributes or the specified attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$firstErrors">
        <td><a href="yii-base-model.html#$firstErrors-detail">$firstErrors</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>The first errors.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="$highlight">
        <td><a href="yii-elasticsearch-activerecord.html#$highlight-detail">$highlight</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a>|<a href="http://www.php.net/language.types.null">null</a></td>
        <td>A list of arrays with highlighted excerpts indexed by field names.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$isNewRecord">
        <td><a href="yii-db-baseactiverecord.html#$isNewRecord-detail">$isNewRecord</a></td>
        <td><a href="http://www.php.net/language.types.boolean">boolean</a></td>
        <td>Whether the record is new and should be inserted when calling <a href="yii-db-baseactiverecord.html#save()-detail">save()</a>.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$iterator">
        <td><a href="yii-base-model.html#$iterator-detail">$iterator</a></td>
        <td><a href="http://www.php.net/class.arrayiterator">ArrayIterator</a></td>
        <td>An iterator for traversing the items in the list.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$oldAttributes">
        <td><a href="yii-db-baseactiverecord.html#$oldAttributes-detail">$oldAttributes</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>The old attribute values (name-value pairs)</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="$oldPrimaryKey">
        <td><a href="yii-elasticsearch-activerecord.html#$oldPrimaryKey-detail">$oldPrimaryKey</a></td>
        <td>mixed</td>
        <td>The old primary key value.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="$primaryKey">
        <td><a href="yii-elasticsearch-activerecord.html#$primaryKey-detail">$primaryKey</a></td>
        <td>mixed</td>
        <td>The primary key value.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$relatedRecords">
        <td><a href="yii-db-baseactiverecord.html#$relatedRecords-detail">$relatedRecords</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>An array of related records indexed by relation names.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$scenario">
        <td><a href="yii-base-model.html#$scenario-detail">$scenario</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The scenario that this model is in.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="$score">
        <td><a href="yii-elasticsearch-activerecord.html#$score-detail">$score</a></td>
        <td><a href="http://www.php.net/language.types.float">float</a></td>
        <td>Returns the score of this record when it was retrieved via a <a href="yii-elasticsearch-activerecord.html#find()-detail">find()</a> query.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$validators">
        <td><a href="yii-base-model.html#$validators-detail">$validators</a></td>
        <td><a href="http://www.php.net/class.arrayobject">ArrayObject</a>|<a href="yii-validators-validator.html">yii\validators\Validator</a>[]</td>
        <td>All the validators declared in the model.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
    </table>
</div>

<a id="methods"></a>

<div class="summary doc-method">
<h2>Public Methods</h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-method" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
        <tr class="inherited" id="__call()">
        <td><a href="yii-base-object.html#__call()-detail">__call()</a></td>
        <td>Calls the named method which is not a class method.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="__clone()">
        <td><a href="yii-base-component.html#__clone()-detail">__clone()</a></td>
        <td>This method is called after the object is created by cloning an existing one.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="__construct()">
        <td><a href="yii-base-object.html#__construct()-detail">__construct()</a></td>
        <td>Constructor.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="__get()">
        <td><a href="yii-db-baseactiverecord.html#__get()-detail">__get()</a></td>
        <td>PHP getter magic method.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="__isset()">
        <td><a href="yii-db-baseactiverecord.html#__isset()-detail">__isset()</a></td>
        <td>Checks if a property value is null.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="__set()">
        <td><a href="yii-db-baseactiverecord.html#__set()-detail">__set()</a></td>
        <td>PHP setter magic method.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="__unset()">
        <td><a href="yii-db-baseactiverecord.html#__unset()-detail">__unset()</a></td>
        <td>Sets a component property to be null.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="activeAttributes()">
        <td><a href="yii-base-model.html#activeAttributes()-detail">activeAttributes()</a></td>
        <td>Returns the attribute names that are subject to validation in the current scenario.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="addError()">
        <td><a href="yii-base-model.html#addError()-detail">addError()</a></td>
        <td>Adds a new error to the specified attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="addErrors()">
        <td><a href="yii-base-model.html#addErrors()-detail">addErrors()</a></td>
        <td>Adds a list of errors.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="afterDelete()">
        <td><a href="yii-db-baseactiverecord.html#afterDelete()-detail">afterDelete()</a></td>
        <td>This method is invoked after deleting a record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="afterFind()">
        <td><a href="yii-db-baseactiverecord.html#afterFind()-detail">afterFind()</a></td>
        <td>This method is called when the AR object is created and populated with the query result.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="afterRefresh()">
        <td><a href="yii-db-baseactiverecord.html#afterRefresh()-detail">afterRefresh()</a></td>
        <td>This method is called when the AR object is refreshed.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="afterSave()">
        <td><a href="yii-db-baseactiverecord.html#afterSave()-detail">afterSave()</a></td>
        <td>This method is called at the end of inserting or updating a record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="afterValidate()">
        <td><a href="yii-base-model.html#afterValidate()-detail">afterValidate()</a></td>
        <td>This method is invoked after validation ends.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="arrayAttributes()">
        <td><a href="yii-elasticsearch-activerecord.html#arrayAttributes()-detail">arrayAttributes()</a></td>
        <td>A list of attributes that should be treated as array valued when retrieved through <a href="yii-elasticsearch-query.html#fields()-detail">yii\elasticsearch\ActiveQuery::fields()</a>.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="attachBehavior()">
        <td><a href="yii-base-component.html#attachBehavior()-detail">attachBehavior()</a></td>
        <td>Attaches a behavior to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="attachBehaviors()">
        <td><a href="yii-base-component.html#attachBehaviors()-detail">attachBehaviors()</a></td>
        <td>Attaches a list of behaviors to the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="attributeHints()">
        <td><a href="yii-base-model.html#attributeHints()-detail">attributeHints()</a></td>
        <td>Returns the attribute hints.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="attributeLabels()">
        <td><a href="yii-base-model.html#attributeLabels()-detail">attributeLabels()</a></td>
        <td>Returns the attribute labels.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="attributes()">
        <td><a href="yii-elasticsearch-activerecord.html#attributes()-detail">attributes()</a></td>
        <td>Returns the list of all attribute names of the model.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="beforeDelete()">
        <td><a href="yii-db-baseactiverecord.html#beforeDelete()-detail">beforeDelete()</a></td>
        <td>This method is invoked before deleting a record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="beforeSave()">
        <td><a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a></td>
        <td>This method is called at the beginning of inserting or updating a record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="beforeValidate()">
        <td><a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a></td>
        <td>This method is invoked before validation starts.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="behaviors()">
        <td><a href="yii-base-component.html#behaviors()-detail">behaviors()</a></td>
        <td>Returns a list of behaviors that this component should behave as.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="canGetProperty()">
        <td><a href="yii-base-object.html#canGetProperty()-detail">canGetProperty()</a></td>
        <td>Returns a value indicating whether a property can be read.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="canSetProperty()">
        <td><a href="yii-base-object.html#canSetProperty()-detail">canSetProperty()</a></td>
        <td>Returns a value indicating whether a property can be set.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="className()">
        <td><a href="yii-base-object.html#className()-detail">className()</a></td>
        <td>Returns the fully qualified name of this class.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="clearErrors()">
        <td><a href="yii-base-model.html#clearErrors()-detail">clearErrors()</a></td>
        <td>Removes errors for all attributes or a single attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="createValidators()">
        <td><a href="yii-base-model.html#createValidators()-detail">createValidators()</a></td>
        <td>Creates validator objects based on the validation rules specified in <a href="yii-base-model.html#rules()-detail">rules()</a>.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="delete()">
        <td><a href="yii-elasticsearch-activerecord.html#delete()-detail">delete()</a></td>
        <td>Deletes the table row corresponding to this active record.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="deleteAll()">
        <td><a href="yii-elasticsearch-activerecord.html#deleteAll()-detail">deleteAll()</a></td>
        <td>Deletes rows in the table using the provided conditions.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="detachBehavior()">
        <td><a href="yii-base-component.html#detachBehavior()-detail">detachBehavior()</a></td>
        <td>Detaches a behavior from the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="detachBehaviors()">
        <td><a href="yii-base-component.html#detachBehaviors()-detail">detachBehaviors()</a></td>
        <td>Detaches all behaviors from the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="ensureBehaviors()">
        <td><a href="yii-base-component.html#ensureBehaviors()-detail">ensureBehaviors()</a></td>
        <td>Makes sure that the behaviors declared in <a href="yii-base-component.html#behaviors()-detail">behaviors()</a> are attached to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="equals()">
        <td><a href="yii-db-baseactiverecord.html#equals()-detail">equals()</a></td>
        <td>Returns a value indicating whether the given active record is the same as the current one.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="extraFields()">
        <td><a href="yii-base-arrayabletrait.html#extraFields()-detail">extraFields()</a></td>
        <td>Returns the list of fields that can be expanded further and returned by <a href="yii-base-arrayabletrait.html#toArray()-detail">toArray()</a>.</td>
        <td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td>
    </tr>
            <tr class="inherited" id="fields()">
        <td><a href="yii-base-arrayabletrait.html#fields()-detail">fields()</a></td>
        <td>Returns the list of fields that should be returned by default by <a href="yii-base-arrayabletrait.html#toArray()-detail">toArray()</a> when no specific fields are specified.</td>
        <td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td>
    </tr>
            <tr id="find()">
        <td><a href="yii-elasticsearch-activerecord.html#find()-detail">find()</a></td>
        <td>Creates an <span class="broken-link">\yii\elasticsearch\ActiveQueryInterface</span> instance for query purpose.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="findAll()">
        <td><a href="yii-elasticsearch-activerecord.html#findAll()-detail">findAll()</a></td>
        <td>Returns a list of active record models that match the specified primary key value(s) or a set of column values.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
                <tr id="findOne()">
        <td><a href="yii-elasticsearch-activerecord.html#findOne()-detail">findOne()</a></td>
        <td>Returns a single active record model instance by a primary key or an array of column values.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="formName()">
        <td><a href="yii-base-model.html#formName()-detail">formName()</a></td>
        <td>Returns the form name that this model class should use.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="generateAttributeLabel()">
        <td><a href="yii-base-model.html#generateAttributeLabel()-detail">generateAttributeLabel()</a></td>
        <td>Generates a user friendly attribute label based on the give attribute name.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="get()">
        <td><a href="yii-elasticsearch-activerecord.html#get()-detail">get()</a></td>
        <td>Gets a record by its primary key.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getActiveValidators()">
        <td><a href="yii-base-model.html#getActiveValidators()-detail">getActiveValidators()</a></td>
        <td>Returns the validators applicable to the current <a href="yii-base-model.html#$scenario-detail">$scenario</a>.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getAttribute()">
        <td><a href="yii-db-baseactiverecord.html#getAttribute()-detail">getAttribute()</a></td>
        <td>Returns the named attribute value.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getAttributeHint()">
        <td><a href="yii-db-baseactiverecord.html#getAttributeHint()-detail">getAttributeHint()</a></td>
        <td>Returns the text hint for the specified attribute.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getAttributeLabel()">
        <td><a href="yii-db-baseactiverecord.html#getAttributeLabel()-detail">getAttributeLabel()</a></td>
        <td>Returns the text label for the specified attribute.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getAttributes()">
        <td><a href="yii-base-model.html#getAttributes()-detail">getAttributes()</a></td>
        <td>Returns attribute values.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getBehavior()">
        <td><a href="yii-base-component.html#getBehavior()-detail">getBehavior()</a></td>
        <td>Returns the named behavior object.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="getBehaviors()">
        <td><a href="yii-base-component.html#getBehaviors()-detail">getBehaviors()</a></td>
        <td>Returns all behaviors attached to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="getDb()">
        <td><a href="yii-elasticsearch-activerecord.html#getDb()-detail">getDb()</a></td>
        <td>Returns the database connection used by this AR class.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getDirtyAttributes()">
        <td><a href="yii-db-baseactiverecord.html#getDirtyAttributes()-detail">getDirtyAttributes()</a></td>
        <td>Returns the attribute values that have been modified since they are loaded or saved most recently.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getErrors()">
        <td><a href="yii-base-model.html#getErrors()-detail">getErrors()</a></td>
        <td>Returns the errors for all attribute or a single attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getFirstError()">
        <td><a href="yii-base-model.html#getFirstError()-detail">getFirstError()</a></td>
        <td>Returns the first error of the specified attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getFirstErrors()">
        <td><a href="yii-base-model.html#getFirstErrors()-detail">getFirstErrors()</a></td>
        <td>Returns the first error of every attribute in the model.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="getHighlight()">
        <td><a href="yii-elasticsearch-activerecord.html#getHighlight()-detail">getHighlight()</a></td>
        <td></td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getIsNewRecord()">
        <td><a href="yii-db-baseactiverecord.html#getIsNewRecord()-detail">getIsNewRecord()</a></td>
        <td>Returns a value indicating whether the current record is new.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getIterator()">
        <td><a href="yii-base-model.html#getIterator()-detail">getIterator()</a></td>
        <td>Returns an iterator for traversing the attributes in the model.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getOldAttribute()">
        <td><a href="yii-db-baseactiverecord.html#getOldAttribute()-detail">getOldAttribute()</a></td>
        <td>Returns the old value of the named attribute.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getOldAttributes()">
        <td><a href="yii-db-baseactiverecord.html#getOldAttributes()-detail">getOldAttributes()</a></td>
        <td>Returns the old attribute values.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="getOldPrimaryKey()">
        <td><a href="yii-elasticsearch-activerecord.html#getOldPrimaryKey()-detail">getOldPrimaryKey()</a></td>
        <td>Returns the old primary key value(s).</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="getPrimaryKey()">
        <td><a href="yii-elasticsearch-activerecord.html#getPrimaryKey()-detail">getPrimaryKey()</a></td>
        <td>Returns the primary key value(s).</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getRelatedRecords()">
        <td><a href="yii-db-baseactiverecord.html#getRelatedRecords()-detail">getRelatedRecords()</a></td>
        <td>Returns all populated related records.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getRelation()">
        <td><a href="yii-db-baseactiverecord.html#getRelation()-detail">getRelation()</a></td>
        <td>Returns the relation object with the specified name.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getScenario()">
        <td><a href="yii-base-model.html#getScenario()-detail">getScenario()</a></td>
        <td>Returns the scenario that this model is used in.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="getScore()">
        <td><a href="yii-elasticsearch-activerecord.html#getScore()-detail">getScore()</a></td>
        <td></td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getValidators()">
        <td><a href="yii-base-model.html#getValidators()-detail">getValidators()</a></td>
        <td>Returns all the validators declared in <a href="yii-base-model.html#rules()-detail">rules()</a>.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="hasAttribute()">
        <td><a href="yii-db-baseactiverecord.html#hasAttribute()-detail">hasAttribute()</a></td>
        <td>Returns a value indicating whether the model has an attribute with the specified name.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="hasErrors()">
        <td><a href="yii-base-model.html#hasErrors()-detail">hasErrors()</a></td>
        <td>Returns a value indicating whether there is any validation error.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="hasEventHandlers()">
        <td><a href="yii-base-component.html#hasEventHandlers()-detail">hasEventHandlers()</a></td>
        <td>Returns a value indicating whether there is any handler attached to the named event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="hasMany()">
        <td><a href="yii-db-baseactiverecord.html#hasMany()-detail">hasMany()</a></td>
        <td>Declares a <code>has-many</code> relation.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="hasMethod()">
        <td><a href="yii-base-object.html#hasMethod()-detail">hasMethod()</a></td>
        <td>Returns a value indicating whether a method is defined.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="hasOne()">
        <td><a href="yii-db-baseactiverecord.html#hasOne()-detail">hasOne()</a></td>
        <td>Declares a <code>has-one</code> relation.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="hasProperty()">
        <td><a href="yii-base-object.html#hasProperty()-detail">hasProperty()</a></td>
        <td>Returns a value indicating whether a property is defined.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr id="index()">
        <td><a href="yii-elasticsearch-activerecord.html#index()-detail">index()</a></td>
        <td></td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="init()">
        <td><a href="yii-db-baseactiverecord.html#init()-detail">init()</a></td>
        <td>Initializes the object.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="insert()">
        <td><a href="yii-elasticsearch-activerecord.html#insert()-detail">insert()</a></td>
        <td>Inserts a document into the associated index using the attribute values of this record.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="instantiate()">
        <td><a href="yii-elasticsearch-activerecord.html#instantiate()-detail">instantiate()</a></td>
        <td>Creates an active record instance.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="isAttributeActive()">
        <td><a href="yii-base-model.html#isAttributeActive()-detail">isAttributeActive()</a></td>
        <td>Returns a value indicating whether the attribute is active in the current scenario.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="isAttributeChanged()">
        <td><a href="yii-db-baseactiverecord.html#isAttributeChanged()-detail">isAttributeChanged()</a></td>
        <td>Returns a value indicating whether the named attribute has been changed.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="isAttributeRequired()">
        <td><a href="yii-base-model.html#isAttributeRequired()-detail">isAttributeRequired()</a></td>
        <td>Returns a value indicating whether the attribute is required.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="isAttributeSafe()">
        <td><a href="yii-base-model.html#isAttributeSafe()-detail">isAttributeSafe()</a></td>
        <td>Returns a value indicating whether the attribute is safe for massive assignments.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="isPrimaryKey()">
        <td><a href="yii-db-baseactiverecord.html#isPrimaryKey()-detail">isPrimaryKey()</a></td>
        <td>Returns a value indicating whether the given set of attributes represents the primary key for this model</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="isRelationPopulated()">
        <td><a href="yii-db-baseactiverecord.html#isRelationPopulated()-detail">isRelationPopulated()</a></td>
        <td>Check whether the named relation has been populated with records.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="link()">
        <td><a href="yii-db-baseactiverecord.html#link()-detail">link()</a></td>
        <td>Establishes the relationship between two models.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="load()">
        <td><a href="yii-base-model.html#load()-detail">load()</a></td>
        <td>Populates the model with input data.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="loadMultiple()">
        <td><a href="yii-base-model.html#loadMultiple()-detail">loadMultiple()</a></td>
        <td>Populates a set of models with the data from end user.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="markAttributeDirty()">
        <td><a href="yii-db-baseactiverecord.html#markAttributeDirty()-detail">markAttributeDirty()</a></td>
        <td>Marks an attribute dirty.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="mget()">
        <td><a href="yii-elasticsearch-activerecord.html#mget()-detail">mget()</a></td>
        <td>Gets a list of records by its primary keys.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="off()">
        <td><a href="yii-base-component.html#off()-detail">off()</a></td>
        <td>Detaches an existing event handler from this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="offsetExists()">
        <td><a href="yii-db-baseactiverecord.html#offsetExists()-detail">offsetExists()</a></td>
        <td>Returns whether there is an element at the specified offset.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="offsetGet()">
        <td><a href="yii-base-model.html#offsetGet()-detail">offsetGet()</a></td>
        <td>Returns the element at the specified offset.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="offsetSet()">
        <td><a href="yii-base-model.html#offsetSet()-detail">offsetSet()</a></td>
        <td>Sets the element at the specified offset.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="offsetUnset()">
        <td><a href="yii-db-baseactiverecord.html#offsetUnset()-detail">offsetUnset()</a></td>
        <td>Sets the element value at the specified offset to null.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="on()">
        <td><a href="yii-base-component.html#on()-detail">on()</a></td>
        <td>Attaches an event handler to an event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="onUnsafeAttribute()">
        <td><a href="yii-base-model.html#onUnsafeAttribute()-detail">onUnsafeAttribute()</a></td>
        <td>This method is invoked when an unsafe attribute is being massively assigned.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="optimisticLock()">
        <td><a href="yii-elasticsearch-activerecord.html#optimisticLock()-detail">optimisticLock()</a></td>
        <td>This method has no effect in Elasticsearch ActiveRecord.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="populateRecord()">
        <td><a href="yii-elasticsearch-activerecord.html#populateRecord()-detail">populateRecord()</a></td>
        <td>Populates an active record object using a row of data from the database/storage.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="populateRelation()">
        <td><a href="yii-db-baseactiverecord.html#populateRelation()-detail">populateRelation()</a></td>
        <td>Populates the named relation with the related records.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="primaryKey()">
        <td><a href="yii-elasticsearch-activerecord.html#primaryKey()-detail">primaryKey()</a></td>
        <td>This method defines the attribute that uniquely identifies a record.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
                <tr class="inherited" id="refresh()">
        <td><a href="yii-db-baseactiverecord.html#refresh()-detail">refresh()</a></td>
        <td>Repopulates this active record with the latest data.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
                <tr class="inherited" id="rules()">
        <td><a href="yii-base-model.html#rules()-detail">rules()</a></td>
        <td>Returns the validation rules for attributes.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="safeAttributes()">
        <td><a href="yii-base-model.html#safeAttributes()-detail">safeAttributes()</a></td>
        <td>Returns the attribute names that are safe to be massively assigned in the current scenario.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="save()">
        <td><a href="yii-db-baseactiverecord.html#save()-detail">save()</a></td>
        <td>Saves the current record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="scenarios()">
        <td><a href="yii-base-model.html#scenarios()-detail">scenarios()</a></td>
        <td>Returns a list of scenarios and the corresponding active attributes.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="setAttribute()">
        <td><a href="yii-db-baseactiverecord.html#setAttribute()-detail">setAttribute()</a></td>
        <td>Sets the named attribute value.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="setAttributes()">
        <td><a href="yii-base-model.html#setAttributes()-detail">setAttributes()</a></td>
        <td>Sets the attribute values in a massive way.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="setIsNewRecord()">
        <td><a href="yii-db-baseactiverecord.html#setIsNewRecord()-detail">setIsNewRecord()</a></td>
        <td>Sets the value indicating whether the record is new.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="setOldAttribute()">
        <td><a href="yii-db-baseactiverecord.html#setOldAttribute()-detail">setOldAttribute()</a></td>
        <td>Sets the old value of the named attribute.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="setOldAttributes()">
        <td><a href="yii-db-baseactiverecord.html#setOldAttributes()-detail">setOldAttributes()</a></td>
        <td>Sets the old attribute values.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="setPrimaryKey()">
        <td><a href="yii-elasticsearch-activerecord.html#setPrimaryKey()-detail">setPrimaryKey()</a></td>
        <td>Sets the primary key</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="setScenario()">
        <td><a href="yii-base-model.html#setScenario()-detail">setScenario()</a></td>
        <td>Sets the scenario for the model.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="toArray()">
        <td><a href="yii-base-arrayabletrait.html#toArray()-detail">toArray()</a></td>
        <td>Converts the model into an array.</td>
        <td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td>
    </tr>
            <tr class="inherited" id="trigger()">
        <td><a href="yii-base-component.html#trigger()-detail">trigger()</a></td>
        <td>Triggers an event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="type()">
        <td><a href="yii-elasticsearch-activerecord.html#type()-detail">type()</a></td>
        <td></td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="unlink()">
        <td><a href="yii-db-baseactiverecord.html#unlink()-detail">unlink()</a></td>
        <td>Destroys the relationship between two models.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="unlinkAll()">
        <td><a href="yii-elasticsearch-activerecord.html#unlinkAll()-detail">unlinkAll()</a></td>
        <td>Destroys the relationship in current model.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="update()">
        <td><a href="yii-elasticsearch-activerecord.html#update()-detail">update()</a></td>
        <td>Saves the changes to this active record into the associated database table.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="updateAll()">
        <td><a href="yii-elasticsearch-activerecord.html#updateAll()-detail">updateAll()</a></td>
        <td>Updates all records whos primary keys are given.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr id="updateAllCounters()">
        <td><a href="yii-elasticsearch-activerecord.html#updateAllCounters()-detail">updateAllCounters()</a></td>
        <td>Updates all matching records using the provided counter changes and conditions.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="updateAttributes()">
        <td><a href="yii-db-baseactiverecord.html#updateAttributes()-detail">updateAttributes()</a></td>
        <td>Updates the specified attributes.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="updateCounters()">
        <td><a href="yii-db-baseactiverecord.html#updateCounters()-detail">updateCounters()</a></td>
        <td>Updates one or several counter columns for the current AR object.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
                <tr class="inherited" id="validate()">
        <td><a href="yii-base-model.html#validate()-detail">validate()</a></td>
        <td>Performs the data validation.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="validateMultiple()">
        <td><a href="yii-base-model.html#validateMultiple()-detail">validateMultiple()</a></td>
        <td>Validates multiple models.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
    </table>
</div>

<div class="summary doc-method">
<h2>Protected Methods</h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-method" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
                                                                                                                                                                        <tr class="inherited" id="findByCondition()">
        <td><a href="yii-db-baseactiverecord.html#findByCondition()-detail">findByCondition()</a></td>
        <td>Finds ActiveRecord instance(s) by the given condition.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
                                                                                                                                                                                                                                                                <tr id="primaryKeysByCondition()">
        <td><a href="yii-elasticsearch-activerecord.html#primaryKeysByCondition()-detail">primaryKeysByCondition()</a></td>
        <td>Performs a quick and highly efficient scroll/scan query to get the list of primary keys that
satisfy the given condition. If condition is a list of primary keys
(e.g.: <code>['_id' =&gt; ['1', '2', '3']]</code>), the query is not performed for performance considerations.</td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
                <tr class="inherited" id="resolveFields()">
        <td><a href="yii-base-arrayabletrait.html#resolveFields()-detail">resolveFields()</a></td>
        <td>Determines which fields can be returned by <a href="yii-base-arrayabletrait.html#toArray()-detail">toArray()</a>.</td>
        <td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td>
    </tr>
                                                                                                <tr id="updateInternal()">
        <td><a href="yii-elasticsearch-activerecord.html#updateInternal()-detail">updateInternal()</a></td>
        <td></td>
        <td><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
    </tr>
            </table>
</div>

<a id="events"></a>
<div class="summary doc-event">
    <h2>Events</h2>

    <p><a href="#" class="toggle">Hide inherited events</a></p>

    <table class="summary-table table table-striped table-bordered table-hover">
    <colgroup>
        <col class="col-event" />
        <col class="col-type" />
        <col class="col-description" />
        <col class="col-defined" />
    </colgroup>
    <tr>
        <th>Event</th><th>Type</th><th>Description</th><th>Defined By</th>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_DELETE">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_DELETE-detail">EVENT_AFTER_DELETE</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event that is triggered after a record is deleted.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_FIND">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_FIND-detail">EVENT_AFTER_FIND</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event that is triggered after the record is created and populated with query result.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_INSERT">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_INSERT-detail">EVENT_AFTER_INSERT</a></td>
        <td><a href="yii-db-aftersaveevent.html">yii\db\AfterSaveEvent</a></td>
        <td>
            An event that is triggered after a record is inserted.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_REFRESH">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_REFRESH-detail">EVENT_AFTER_REFRESH</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event that is triggered after a record is refreshed.                            (available since version 2.0.8)
                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_UPDATE">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_UPDATE-detail">EVENT_AFTER_UPDATE</a></td>
        <td><a href="yii-db-aftersaveevent.html">yii\db\AfterSaveEvent</a></td>
        <td>
            An event that is triggered after a record is updated.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_VALIDATE">
        <td><a href="yii-base-model.html#EVENT_AFTER_VALIDATE-detail">EVENT_AFTER_VALIDATE</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event raised at the end of <a href="yii-base-model.html#validate()-detail">validate()</a>                    </td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
        <tr class="inherited" id="EVENT_BEFORE_DELETE">
        <td><a href="yii-db-baseactiverecord.html#EVENT_BEFORE_DELETE-detail">EVENT_BEFORE_DELETE</a></td>
        <td><a href="yii-base-modelevent.html">yii\base\ModelEvent</a></td>
        <td>
            An event that is triggered before deleting a record.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_BEFORE_INSERT">
        <td><a href="yii-db-baseactiverecord.html#EVENT_BEFORE_INSERT-detail">EVENT_BEFORE_INSERT</a></td>
        <td><a href="yii-base-modelevent.html">yii\base\ModelEvent</a></td>
        <td>
            An event that is triggered before inserting a record.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_BEFORE_UPDATE">
        <td><a href="yii-db-baseactiverecord.html#EVENT_BEFORE_UPDATE-detail">EVENT_BEFORE_UPDATE</a></td>
        <td><a href="yii-base-modelevent.html">yii\base\ModelEvent</a></td>
        <td>
            An event that is triggered before updating a record.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_BEFORE_VALIDATE">
        <td><a href="yii-base-model.html#EVENT_BEFORE_VALIDATE-detail">EVENT_BEFORE_VALIDATE</a></td>
        <td><a href="yii-base-modelevent.html">yii\base\ModelEvent</a></td>
        <td>
            An event raised at the beginning of <a href="yii-base-model.html#validate()-detail">validate()</a>.                    </td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
        <tr class="inherited" id="EVENT_INIT">
        <td><a href="yii-db-baseactiverecord.html#EVENT_INIT-detail">EVENT_INIT</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event that is triggered when the record is initialized via <a href="yii-db-baseactiverecord.html#init()-detail">init()</a>.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        </table>
</div>

<a id="constants"></a>
<div class="summary doc-const">
    <h2>Constants</h2>

    <p><a href="#" class="toggle">Hide inherited constants</a></p>

    <table class="summary-table table table-striped table-bordered table-hover">
    <colgroup>
        <col class="col-const" />
        <col class="col-value" />
        <col class="col-description" />
        <col class="col-defined" />
    </colgroup>
    <tr>
        <th>Constant</th><th>Value</th><th>Description</th><th>Defined By</th>
    </tr>
            <tr class="inherited" id="SCENARIO_DEFAULT">
          <td id="SCENARIO_DEFAULT-detail">SCENARIO_DEFAULT</td>
          <td>'default'</td>
          <td>The name of the default scenario.
</td>
          <td><a href="yii-base-model.html">yii\base\Model</a></td>
        </tr>
        </table>
</div>

<h2>Property Details</h2>

<div class="property-doc">

    <div class="detail-header h3" id="$highlight-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#$highlight-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $highlight        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>A list of arrays with highlighted excerpts indexed by field names.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a>|<a href="http://www.php.net/language.types.null">null</a></span> <strong><a href="yii-elasticsearch-activerecord.html#getHighlight()-detail">getHighlight</a></strong> ( )</div>


    <div class="detail-header h3" id="$oldPrimaryKey-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#$oldPrimaryKey-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $oldPrimaryKey        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>The old primary key value. An array (column name =&gt; column value) is returned if the primary key
is composite or <code>$asArray</code> is true. A string is returned otherwise (null will be returned if
the key value is null).</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type">mixed</span> <strong><a href="yii-elasticsearch-activerecord.html#getOldPrimaryKey()-detail">getOldPrimaryKey</a></strong> ( <span style="color: #0000BB">$asArray&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span> )</div>


    <div class="detail-header h3" id="$primaryKey-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#$primaryKey-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $primaryKey        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The primary key value. An array (column name =&gt; column value) is returned if the primary key
is composite or <code>$asArray</code> is true. A string is returned otherwise (null will be returned if
the key value is null).</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type">mixed</span> <strong><a href="yii-elasticsearch-activerecord.html#getPrimaryKey()-detail">getPrimaryKey</a></strong> ( <span style="color: #0000BB">$asArray&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span> )<br /><span class="signature-defs">public</span> <span class="signature-type">void</span> <strong><a href="yii-elasticsearch-activerecord.html#setPrimaryKey()-detail">setPrimaryKey</a></strong> ( <span style="color: #0000BB">$value</span> )</div>


    <div class="detail-header h3" id="$score-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#$score-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $score        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>Returns the score of this record when it was retrieved via a <a href="yii-elasticsearch-activerecord.html#find()-detail">find()</a> query.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.float">float</a></span> <strong><a href="yii-elasticsearch-activerecord.html#getScore()-detail">getScore</a></strong> ( )</div>

</div>
<h2>Method Details</h2>

<div class="method-doc">

    <div class="detail-header h3" id="arrayAttributes()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#arrayAttributes()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L290" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L290" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        arrayAttributes()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>A list of attributes that should be treated as array valued when retrieved through <a href="yii-elasticsearch-query.html#fields()-detail">yii\elasticsearch\ActiveQuery::fields()</a>.</strong></p>

        <p>If not listed by this method, attributes retrieved through <a href="yii-elasticsearch-query.html#fields()-detail">yii\elasticsearch\ActiveQuery::fields()</a> will converted to a scalar value
when the result array contains only one value.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a>[]</span> <strong><a href="yii-elasticsearch-activerecord.html#arrayAttributes()-detail">arrayAttributes</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>[]</td>
                  <td class="param-desc-col"><p>List of attribute names. Must be a subset of <a href="yii-elasticsearch-activerecord.html#attributes()-detail">attributes()</a>.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="attributes()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#attributes()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L277" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L277" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        attributes()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the list of all attribute names of the model.</strong></p>

        <p>This method must be overridden by child classes to define available attributes.</p>
<p>Attributes are names of fields of the corresponding elasticsearch document.
The primaryKey for elasticsearch documents is the <code>_id</code> field by default which is not part of the attributes.
You may define <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html">path mapping</a>
for the <code>_id</code> field so that it is part of the <code>_source</code> fields and thus becomes part of the attributes.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a>[]</span> <strong><a href="yii-elasticsearch-activerecord.html#attributes()-detail">attributes</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>[]</td>
                  <td class="param-desc-col"><p>List of attribute names.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-base-invalidconfigexception.html">yii\base\InvalidConfigException</a></td>
                  <td class="param-desc-col"><p>if not overridden in a child class.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="delete()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#delete()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L716" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L716" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        delete()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Deletes the table row corresponding to this active record.</strong></p>

        <p>This method performs the following steps in order:</p>
<ol>
<li>call <a href="yii-db-baseactiverecord.html#beforeDelete()-detail">beforeDelete()</a>. If the method returns false, it will skip the
rest of the steps;</li>
<li>delete the record from the database;</li>
<li>call <a href="yii-db-baseactiverecord.html#afterDelete()-detail">afterDelete()</a>.</li>
</ol>
<p>In the above step 1 and 3, events named <a href="yii-db-baseactiverecord.html#EVENT_BEFORE_DELETE-detail">EVENT_BEFORE_DELETE</a> and <a href="yii-db-baseactiverecord.html#EVENT_AFTER_DELETE-detail">EVENT_AFTER_DELETE</a>
will be raised by the corresponding methods.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-elasticsearch-activerecord.html#delete()-detail">delete</a></strong> ( <span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$options</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Options given in this parameter are passed to elasticsearch
as request URI parameters. These are among others:</p>
<ul>
<li><code>routing</code> define shard placement of this record.</li>
<li><code>parent</code> by giving the primaryKey of another record this defines a parent-child relation</li>
<li><code>timeout</code> timeout waiting for a shard to become available.</li>
<li><code>replication</code> the replication type for the delete/index operation (sync or async).</li>
<li><code>consistency</code> the write consistency of the index/delete operation.</li>
<li><code>refresh</code> refresh the relevant primary and replica shards (not the whole index) immediately after the operation occurs, so that the updated document appears in search results immediately.</li>
</ul>
<p>Please refer to the <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html">elasticsearch documentation</a>
for more details on these options.</p>
<p>The following parameters are Yii specific:</p>
<ul>
<li><p><code>optimistic_locking</code> set this to <code>true</code> to enable optimistic locking, avoid updating when the record has changed since it
has been loaded from the database. Yii will set the <code>version</code> parameter to the value stored in <span class="broken-link">\yii\elasticsearch\version</span>.
See the <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html#delete-versioning">elasticsearch documentation</a> for details.</p>
<p>Make sure the record has been fetched with a <span class="broken-link">\yii\elasticsearch\version</span> before. This is only the case
for records fetched via <a href="yii-elasticsearch-activerecord.html#get()-detail">get()</a> and <a href="yii-elasticsearch-activerecord.html#mget()-detail">mget()</a> by default. For normal queries, the <code>_version</code> field has to be fetched explicitly.</p>
</li>
</ul>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>The number of rows deleted, or false if the deletion is unsuccessful for some reason.
Note that it is possible the number of rows deleted is 0, even though the deletion execution is successful.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-db-staleobjectexception.html">yii\db\StaleObjectException</a></td>
                  <td class="param-desc-col"><p>if optimistic locking is enabled and the data being deleted is outdated.</p>
</td>
                </tr>
                            <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-elasticsearch-exception.html">yii\elasticsearch\Exception</a></td>
                  <td class="param-desc-col"><p>in case delete failed.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="deleteAll()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#deleteAll()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L772" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L772" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        deleteAll()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Deletes rows in the table using the provided conditions.</strong></p>

        <p>WARNING: If you do not specify any condition, this method will delete ALL rows in the table.</p>
<p>For example, to delete all customers whose status is 3:</p>
<pre><code class="hljs css"><span class="hljs-rule"><span class="hljs-attribute">Customer</span>:<span class="hljs-value">:<span class="hljs-function">deleteAll</span>([<span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">3</span>])</span></span>;
</code></pre>

        <p>See also [[<a href="yii-elasticsearch-activerecord.html#primaryKeysByCondition()-detail">yii\elasticsearch\ActiveRecord::primaryKeysByCondition()</a>]].</p>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <strong><a href="yii-elasticsearch-activerecord.html#deleteAll()-detail">deleteAll</a></strong> ( <span style="color: #0000BB">$condition&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The conditions that will be passed to the <code>where()</code> method when building the query.
Please refer to <a href="yii-db-querytrait.html#where()-detail">yii\elasticsearch\ActiveQuery::where()</a> on how to specify this parameter.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The number of rows deleted</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-elasticsearch-exception.html">yii\elasticsearch\Exception</a></td>
                  <td class="param-desc-col"><p>on error.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="find()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#find()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L78" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L78" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        find()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Creates an <span class="broken-link">\yii\elasticsearch\ActiveQueryInterface</span> instance for query purpose.</strong></p>

        <p>The returned <span class="broken-link">\yii\elasticsearch\ActiveQueryInterface</span> instance can be further customized by calling
methods defined in <span class="broken-link">\yii\elasticsearch\ActiveQueryInterface</span> before <code>one()</code> or <code>all()</code> is called to return
populated ActiveRecord instances. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-comment">// find the customer whose ID is 1</span>
<span class="hljs-variable">$customer</span> = Customer::find()-&gt;where([<span class="hljs-string">'id'</span> =&gt; <span class="hljs-number">1</span>])-&gt;one();

<span class="hljs-comment">// find all active customers and order them by their age:</span>
<span class="hljs-variable">$customers</span> = Customer::find()
    -&gt;where([<span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">1</span>])
    -&gt;orderBy(<span class="hljs-string">'age'</span>)
    -&gt;all();
</code></pre>
<p>This method is also called by <a href="yii-db-baseactiverecord.html#hasOne()-detail">yii\db\BaseActiveRecord::hasOne()</a> and <a href="yii-db-baseactiverecord.html#hasMany()-detail">yii\db\BaseActiveRecord::hasMany()</a> to
create a relational query.</p>
<p>You may override this method to return a customized query. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Customer</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ActiveRecord</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">find</span><span class="hljs-params">()</span>
    </span>{
        <span class="hljs-comment">// use CustomerQuery instead of the default ActiveQuery</span>
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> CustomerQuery(get_called_class());
    }
}
</code></pre>
<p>The following code shows how to apply a default condition for all queries:</p>
<pre><code class="hljs php language-php"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Customer</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ActiveRecord</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">find</span><span class="hljs-params">()</span>
    </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">parent</span>::find()-&gt;where([<span class="hljs-string">'deleted'</span> =&gt; <span class="hljs-keyword">false</span>]);
    }
}

<span class="hljs-comment">// Use andWhere()/orWhere() to apply the default condition</span>
<span class="hljs-comment">// SELECT FROM customer WHERE `deleted`=:deleted AND age&gt;30</span>
<span class="hljs-variable">$customers</span> = Customer::find()-&gt;andWhere(<span class="hljs-string">'age&gt;30'</span>)-&gt;all();

<span class="hljs-comment">// Use where() to ignore the default condition</span>
<span class="hljs-comment">// SELECT FROM customer WHERE age&gt;30</span>
<span class="hljs-variable">$customers</span> = Customer::find()-&gt;where(<span class="hljs-string">'age&gt;30'</span>)-&gt;all();


</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="yii-elasticsearch-activequery.html">yii\elasticsearch\ActiveQuery</a></span> <strong><a href="yii-elasticsearch-activerecord.html#find()-detail">find</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-elasticsearch-activequery.html">yii\elasticsearch\ActiveQuery</a></td>
                  <td class="param-desc-col"><p>The newly created <a href="yii-elasticsearch-activequery.html">yii\elasticsearch\ActiveQuery</a> instance.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="findAll()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#findAll()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L99" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L99" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        findAll()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns a list of active record models that match the specified primary key value(s) or a set of column values.</strong></p>

        <p>The method accepts:</p>
<ul>
<li>a scalar value (integer or string): query by a single primary key value and return an array containing the
corresponding record (or an empty array if not found).</li>
<li>a non-associative array: query by a list of primary key values and return the
corresponding records (or an empty array if none was found).
Note that an empty condition will result in an empty result as it will be interpreted as a search for
primary keys and not an empty <code>WHERE</code> condition.</li>
<li>an associative array of name-value pairs: query by a set of attribute values and return an array of records
matching all of them (or an empty array if none was found). Note that <code>['id' =&gt; 1, 2]</code> is treated as
a non-associative array.</li>
</ul>
<p>This method will automatically call the <code>all()</code> method and return an array of <span class="broken-link">\yii\elasticsearch\ActiveRecordInterface</span>
instances. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-comment">// find the customers whose primary key value is 10</span>
<span class="hljs-variable">$customers</span> = Customer::findAll(<span class="hljs-number">10</span>);

<span class="hljs-comment">// the above code is equivalent to:</span>
<span class="hljs-variable">$customers</span> = Customer::find()-&gt;where([<span class="hljs-string">'id'</span> =&gt; <span class="hljs-number">10</span>])-&gt;all();

<span class="hljs-comment">// find the customers whose primary key value is 10, 11 or 12.</span>
<span class="hljs-variable">$customers</span> = Customer::findAll([<span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>]);

<span class="hljs-comment">// the above code is equivalent to:</span>
<span class="hljs-variable">$customers</span> = Customer::find()-&gt;where([<span class="hljs-string">'id'</span> =&gt; [<span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>]])-&gt;all();

<span class="hljs-comment">// find customers whose age is 30 and whose status is 1</span>
<span class="hljs-variable">$customers</span> = Customer::findAll([<span class="hljs-string">'age'</span> =&gt; <span class="hljs-number">30</span>, <span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">1</span>]);

<span class="hljs-comment">// the above code is equivalent to:</span>
<span class="hljs-variable">$customers</span> = Customer::find()-&gt;where([<span class="hljs-string">'age'</span> =&gt; <span class="hljs-number">30</span>, <span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">1</span>])-&gt;all();
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type">static[]</span> <strong><a href="yii-elasticsearch-activerecord.html#findAll()-detail">findAll</a></strong> ( <span style="color: #0000BB">$condition</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>Primary key value or a set of column values</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">static[]</td>
                  <td class="param-desc-col"><p>An array of ActiveRecord instances, or an empty array if nothing matches.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="findOne()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#findOne()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L86" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L86" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        findOne()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns a single active record model instance by a primary key or an array of column values.</strong></p>

        <p>The method accepts:</p>
<ul>
<li>a scalar value (integer or string): query by a single primary key value and return the
corresponding record (or null if not found).</li>
<li>a non-associative array: query by a list of primary key values and return the
first record (or null if not found).</li>
<li>an associative array of name-value pairs: query by a set of attribute values and return a single record
matching all of them (or null if not found). Note that <code>['id' =&gt; 1, 2]</code> is treated as a non-associative array.</li>
</ul>
<p>That this method will automatically call the <code>one()</code> method and return an <span class="broken-link">\yii\elasticsearch\ActiveRecordInterface</span>
instance. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-comment">// find a single customer whose primary key value is 10</span>
<span class="hljs-variable">$customer</span> = Customer::findOne(<span class="hljs-number">10</span>);

<span class="hljs-comment">// the above code is equivalent to:</span>
<span class="hljs-variable">$customer</span> = Customer::find()-&gt;where([<span class="hljs-string">'id'</span> =&gt; <span class="hljs-number">10</span>])-&gt;one();

<span class="hljs-comment">// find the first customer whose age is 30 and whose status is 1</span>
<span class="hljs-variable">$customer</span> = Customer::findOne([<span class="hljs-string">'age'</span> =&gt; <span class="hljs-number">30</span>, <span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">1</span>]);

<span class="hljs-comment">// the above code is equivalent to:</span>
<span class="hljs-variable">$customer</span> = Customer::find()-&gt;where([<span class="hljs-string">'age'</span> =&gt; <span class="hljs-number">30</span>, <span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">1</span>])-&gt;one();
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type">static|<a href="http://www.php.net/language.types.null">null</a></span> <strong><a href="yii-elasticsearch-activerecord.html#findOne()-detail">findOne</a></strong> ( <span style="color: #0000BB">$condition</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>Primary key value or a set of column values</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">static|<a href="http://www.php.net/language.types.null">null</a></td>
                  <td class="param-desc-col"><p>ActiveRecord instance matching the condition, or <code>null</code> if nothing matches.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="get()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#get()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L119" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L119" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        get()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Gets a record by its primary key.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type">static|<a href="http://www.php.net/language.types.null">null</a></span> <strong><a href="yii-elasticsearch-activerecord.html#get()-detail">get</a></strong> ( <span style="color: #0000BB">$primaryKey</span>, <span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$primaryKey</span></td>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>The primaryKey value</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$options</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Options given in this parameter are passed to elasticsearch
as request URI parameters.
Please refer to the <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">elasticsearch documentation</a>
for more details on these options.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">static|<a href="http://www.php.net/language.types.null">null</a></td>
                  <td class="param-desc-col"><p>The record instance or null if it was not found.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getDb()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#getDb()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L69" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L69" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getDb()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the database connection used by this AR class.</strong></p>

        <p>By default, the "elasticsearch" application component is used as the database connection.
You may override this method if you want to use a different database connection.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="yii-elasticsearch-connection.html">yii\elasticsearch\Connection</a></span> <strong><a href="yii-elasticsearch-activerecord.html#getDb()-detail">getDb</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-elasticsearch-connection.html">yii\elasticsearch\Connection</a></td>
                  <td class="param-desc-col"><p>The database connection used by this AR class.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getHighlight()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#getHighlight()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L190" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L190" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getHighlight()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong></strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a>|<a href="http://www.php.net/language.types.null">null</a></span> <strong><a href="yii-elasticsearch-activerecord.html#getHighlight()-detail">getHighlight</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a>|<a href="http://www.php.net/language.types.null">null</a></td>
                  <td class="param-desc-col"><p>A list of arrays with highlighted excerpts indexed by field names.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getOldPrimaryKey()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#getOldPrimaryKey()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L226" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L226" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getOldPrimaryKey()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the old primary key value(s).</strong></p>

        <p>This refers to the primary key value that is populated into the record
after executing a find method (e.g. find(), findOne()).
The value remains unchanged even if the primary key attribute is manually assigned with a different value.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">mixed</span> <strong><a href="yii-elasticsearch-activerecord.html#getOldPrimaryKey()-detail">getOldPrimaryKey</a></strong> ( <span style="color: #0000BB">$asArray&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$asArray</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to return the primary key value as an array. If true,
the return value will be an array with column name as key and column value as value.
If this is false (default), a scalar value will be returned for non-composite primary key.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>The old primary key value. An array (column name =&gt; column value) is returned if the primary key
is composite or <code>$asArray</code> is true. A string is returned otherwise (null will be returned if
the key value is null).</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-db-exception.html">yii\db\Exception</a></td>
                  <td class="param-desc-col"><p>if the AR model does not have a primary key</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="getPrimaryKey()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#getPrimaryKey()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L213" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L213" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getPrimaryKey()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the primary key value(s).</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">mixed</span> <strong><a href="yii-elasticsearch-activerecord.html#getPrimaryKey()-detail">getPrimaryKey</a></strong> ( <span style="color: #0000BB">$asArray&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$asArray</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to return the primary key value as an array. If true,
the return value will be an array with column names as keys and column values as values.
Note that for composite primary keys, an array will always be returned regardless of this parameter value.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>The primary key value. An array (column name =&gt; column value) is returned if the primary key
is composite or <code>$asArray</code> is true. A string is returned otherwise (null will be returned if
the key value is null).</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getScore()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#getScore()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L182" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L182" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getScore()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong></strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.float">float</a></span> <strong><a href="yii-elasticsearch-activerecord.html#getScore()-detail">getScore</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.float">float</a></td>
                  <td class="param-desc-col"><p>Returns the score of this record when it was retrieved via a <a href="yii-elasticsearch-activerecord.html#find()-detail">find()</a> query.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="index()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#index()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L298" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L298" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        index()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong></strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-elasticsearch-activerecord.html#index()-detail">index</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The name of the index this record is stored in.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="insert()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#insert()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L418" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L418" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        insert()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Inserts a document into the associated index using the attribute values of this record.</strong></p>

        <p>This method performs the following steps in order:</p>
<ol>
<li>call <a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a> when <code>$runValidation</code> is true. If validation
fails, it will skip the rest of the steps;</li>
<li>call <a href="yii-base-model.html#afterValidate()-detail">afterValidate()</a> when <code>$runValidation</code> is true.</li>
<li>call <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a>. If the method returns false, it will skip the
rest of the steps;</li>
<li>insert the record into database. If this fails, it will skip the rest of the steps;</li>
<li>call <a href="yii-db-baseactiverecord.html#afterSave()-detail">afterSave()</a>;</li>
</ol>
<p>In the above step 1, 2, 3 and 5, events <a href="yii-base-model.html#EVENT_BEFORE_VALIDATE-detail">EVENT_BEFORE_VALIDATE</a>,
<a href="yii-db-baseactiverecord.html#EVENT_BEFORE_INSERT-detail">EVENT_BEFORE_INSERT</a>, <a href="yii-db-baseactiverecord.html#EVENT_AFTER_INSERT-detail">EVENT_AFTER_INSERT</a> and <a href="yii-base-model.html#EVENT_AFTER_VALIDATE-detail">EVENT_AFTER_VALIDATE</a>
will be raised by the corresponding methods.</p>
<p>Only the <a href="yii-db-baseactiverecord.html#$dirtyAttributes-detail">changed attribute values</a> will be inserted into database.</p>
<p>If the <a href="yii-elasticsearch-activerecord.html#primaryKey()-detail">primary key</a> is not set (null) during insertion,
it will be populated with a
<a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#_automatic_id_generation">randomly generated value</a>
after insertion.</p>
<p>For example, to insert a customer record:</p>
<pre><code class="hljs php"><span class="hljs-variable">$customer</span> = <span class="hljs-keyword">new</span> Customer;
<span class="hljs-variable">$customer</span>-&gt;name = <span class="hljs-variable">$name</span>;
<span class="hljs-variable">$customer</span>-&gt;email = <span class="hljs-variable">$email</span>;
<span class="hljs-variable">$customer</span>-&gt;insert();
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-elasticsearch-activerecord.html#insert()-detail">insert</a></strong> ( <span style="color: #0000BB">$runValidation&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span>, <span style="color: #0000BB">$attributes&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span>, <span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">=&nbsp;[</span><span style="color: #DD0000">'op_type'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'create'</span><span style="color: #007700">]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$runValidation</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to perform validation before saving the record.
If the validation fails, the record will not be inserted into the database.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$attributes</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>List of attributes that need to be saved. Defaults to null,
meaning all attributes will be saved.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$options</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Options given in this parameter are passed to elasticsearch
as request URI parameters. These are among others:</p>
<ul>
<li><code>routing</code> define shard placement of this record.</li>
<li><code>parent</code> by giving the primaryKey of another record this defines a parent-child relation</li>
<li><code>timestamp</code> specifies the timestamp to store along with the document. Default is indexing time.</li>
</ul>
<p>Please refer to the <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html">elasticsearch documentation</a>
for more details on these options.</p>
<p>By default the <code>op_type</code> is set to <code>create</code>.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether the attributes are valid and the record is inserted successfully.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="instantiate()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#instantiate()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L363" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L363" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        instantiate()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Creates an active record instance.</strong></p>

        <p>This method is called together with <a href="yii-elasticsearch-activerecord.html#populateRecord()-detail">populateRecord()</a> by <a href="yii-elasticsearch-activequery.html">yii\elasticsearch\ActiveQuery</a>.
It is not meant to be used for creating new records directly.</p>
<p>You may override this method if the instance being created
depends on the row data to be populated into the record.
For example, by creating a record based on the value of a column,
you may implement the so-called single-table inheritance mapping.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type">static</span> <strong><a href="yii-elasticsearch-activerecord.html#instantiate()-detail">instantiate</a></strong> ( <span style="color: #0000BB">$row</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$row</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Row data to be populated into the record.
This array consists of the following keys:</p>
<ul>
<li><code>_source</code>: refers to the attributes of the record.</li>
<li><code>_type</code>: the type this record is stored in.</li>
<li><code>_index</code>: the index this record is stored in.</li>
</ul>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">static</td>
                  <td class="param-desc-col"><p>The newly created active record</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="mget()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#mget()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L148" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L148" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        mget()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Gets a list of records by its primary keys.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <strong><a href="yii-elasticsearch-activerecord.html#mget()-detail">mget</a></strong> ( <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <span style="color: #0000BB">$primaryKeys</span>, <span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$primaryKeys</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>An array of primaryKey values</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$options</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Options given in this parameter are passed to elasticsearch
as request URI parameters.</p>
<p>Please refer to the <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">elasticsearch documentation</a>
for more details on these options.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The record instances, or empty array if nothing was found</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="optimisticLock()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#optimisticLock()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L812" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L812" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        optimisticLock()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>This method has no effect in Elasticsearch ActiveRecord.</strong></p>

        <p>Elasticsearch ActiveRecord uses <a href="http://www.elastic.co/guide/en/elasticsearch/guide/current/optimistic-concurrency-control.html">native Optimistic locking</a>.
See <a href="yii-elasticsearch-activerecord.html#update()-detail">update()</a> for more details.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">void</span> <strong><a href="yii-elasticsearch-activerecord.html#optimisticLock()-detail">optimisticLock</a></strong> ( )</td></tr>
            </table>

<!--	-->

    <div class="detail-header h3" id="populateRecord()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#populateRecord()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L318" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L318" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        populateRecord()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Populates an active record object using a row of data from the database/storage.</strong></p>

        <p>This is an internal method meant to be called to create active record objects after
fetching data from the database. It is mainly used by <a href="yii-elasticsearch-activequery.html">yii\elasticsearch\ActiveQuery</a> to populate
the query results into active records.</p>
<p>When calling this method manually you should call <a href="yii-db-baseactiverecord.html#afterFind()-detail">afterFind()</a> on the created
record to trigger the <a href="yii-db-baseactiverecord.html#EVENT_AFTER_FIND-detail">afterFind Event</a>.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type">void</span> <strong><a href="yii-elasticsearch-activerecord.html#populateRecord()-detail">populateRecord</a></strong> ( <span style="color: #0000BB">$record</span>, <span style="color: #0000BB">$row</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$record</span></td>
                  <td class="param-type-col"><a href="yii-elasticsearch-activerecord.html">yii\elasticsearch\ActiveRecord</a></td>
                  <td class="param-desc-col"><p>The record to be populated. In most cases this will be an instance
created by <a href="yii-elasticsearch-activerecord.html#instantiate()-detail">instantiate()</a> beforehand.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$row</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Attribute values (name =&gt; value)</p>
</td>
                </tr>
                                                </table>

<!--	-->

    <div class="detail-header h3" id="primaryKey()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#primaryKey()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L259" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L259" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        primaryKey()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>This method defines the attribute that uniquely identifies a record.</strong></p>

        <p>The primaryKey for elasticsearch documents is the <code>_id</code> field by default. This field is not part of the
ActiveRecord attributes so you should never add <code>_id</code> to the list of <a href="yii-elasticsearch-activerecord.html#attributes()-detail">attributes</a>.</p>
<p>You may override this method to define the primary key name when you have defined
<a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html">path mapping</a>
for the <code>_id</code> field so that it is part of the <code>_source</code> and thus part of the <a href="yii-elasticsearch-activerecord.html#attributes()-detail">attributes</a>.</p>
<p>Note that elasticsearch only supports <em>one</em> attribute to be the primary key. However to match the signature
of the <a href="yii-db-activerecordinterface.html">ActiveRecordInterface</a> this methods returns an array instead of a
single string.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a>[]</span> <strong><a href="yii-elasticsearch-activerecord.html#primaryKey()-detail">primaryKey</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>[]</td>
                  <td class="param-desc-col"><p>Array of primary key attributes. Only the first element of the array will be used.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="primaryKeysByCondition()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#primaryKeysByCondition()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L571" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L571" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        primaryKeysByCondition()
        <span class="detail-header-tag small">
            protected                        static            method
                            (available since version 2.0.4)
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Performs a quick and highly efficient scroll/scan query to get the list of primary keys that
satisfy the given condition. If condition is a list of primary keys
(e.g.: <code>['_id' =&gt; ['1', '2', '3']]</code>), the query is not performed for performance considerations.</strong></p>

        
        <p>See also:</p><ul><li><a href="yii-elasticsearch-activerecord.html#updateAll()-detail">updateAll()</a></li><li><a href="yii-elasticsearch-activerecord.html#updateAllCounters()-detail">updateAllCounters()</a></li><li><a href="yii-elasticsearch-activerecord.html#deleteAll()-detail">deleteAll()</a></li></ul>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">protected static</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <strong><a href="yii-elasticsearch-activerecord.html#primaryKeysByCondition()-detail">primaryKeysByCondition</a></strong> ( <span style="color: #0000BB">$condition</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Please refer to <a href="yii-db-querytrait.html#where()-detail">yii\elasticsearch\ActiveQuery::where()</a> on how to specify this parameter</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Primary keys that correspond to given conditions</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="setPrimaryKey()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#setPrimaryKey()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L200" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L200" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        setPrimaryKey()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Sets the primary key</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">void</span> <strong><a href="yii-elasticsearch-activerecord.html#setPrimaryKey()-detail">setPrimaryKey</a></strong> ( <span style="color: #0000BB">$value</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$value</span></td>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"></td>
                </tr>
                                                    <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-base-invalidcallexception.html">yii\base\InvalidCallException</a></td>
                  <td class="param-desc-col"><p>when record is not new</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="type()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#type()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L306" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L306" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        type()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong></strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-elasticsearch-activerecord.html#type()-detail">type</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The name of the type of this record.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="unlinkAll()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#unlinkAll()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L822" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L822" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        unlinkAll()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Destroys the relationship in current model.</strong></p>

        <p>This method is not supported by elasticsearch.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">void</span> <strong><a href="yii-elasticsearch-activerecord.html#unlinkAll()-detail">unlinkAll</a></strong> ( <span style="color: #0000BB">$name</span>, <span style="color: #0000BB">$delete&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$name</span></td>
                  <td class="param-type-col"></td>
                  <td class="param-desc-col"></td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$delete</span></td>
                  <td class="param-type-col"></td>
                  <td class="param-desc-col"></td>
                </tr>
                                                </table>

<!--	-->

    <div class="detail-header h3" id="update()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#update()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L487" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L487" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        update()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Saves the changes to this active record into the associated database table.</strong></p>

        <p>This method performs the following steps in order:</p>
<ol>
<li>call <a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a> when <code>$runValidation</code> is true. If <a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a>
returns <code>false</code>, the rest of the steps will be skipped;</li>
<li>call <a href="yii-base-model.html#afterValidate()-detail">afterValidate()</a> when <code>$runValidation</code> is true. If validation
failed, the rest of the steps will be skipped;</li>
<li>call <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a>. If <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a> returns <code>false</code>,
the rest of the steps will be skipped;</li>
<li>save the record into database. If this fails, it will skip the rest of the steps;</li>
<li>call <a href="yii-db-baseactiverecord.html#afterSave()-detail">afterSave()</a>;</li>
</ol>
<p>In the above step 1, 2, 3 and 5, events <a href="yii-base-model.html#EVENT_BEFORE_VALIDATE-detail">EVENT_BEFORE_VALIDATE</a>,
<a href="yii-base-model.html#EVENT_AFTER_VALIDATE-detail">EVENT_AFTER_VALIDATE</a>, <a href="yii-db-baseactiverecord.html#EVENT_BEFORE_UPDATE-detail">EVENT_BEFORE_UPDATE</a>, and <a href="yii-db-baseactiverecord.html#EVENT_AFTER_UPDATE-detail">EVENT_AFTER_UPDATE</a>
will be raised by the corresponding methods.</p>
<p>Only the <a href="yii-db-baseactiverecord.html#$dirtyAttributes-detail">changed attribute values</a> will be saved into database.</p>
<p>For example, to update a customer record:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$customer</span> = Customer::findOne(<span class="hljs-variable">$id</span>);
<span class="hljs-variable">$customer</span>-&gt;name = <span class="hljs-variable">$name</span>;
<span class="hljs-variable">$customer</span>-&gt;email = <span class="hljs-variable">$email</span>;
<span class="hljs-variable">$customer</span>-&gt;update();
</code></pre>
<p>Note that it is possible the update does not affect any row in the table.
In this case, this method will return 0. For this reason, you should use the following
code to check if update() is successful or not:</p>
<pre><code class="hljs php language-php"><span class="hljs-keyword">if</span> (<span class="hljs-variable">$customer</span>-&gt;update() !== <span class="hljs-keyword">false</span>) {
    <span class="hljs-comment">// update successful</span>
} <span class="hljs-keyword">else</span> {
    <span class="hljs-comment">// update failed</span>
}
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-elasticsearch-activerecord.html#update()-detail">update</a></strong> ( <span style="color: #0000BB">$runValidation&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span>, <span style="color: #0000BB">$attributeNames&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span>, <span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$runValidation</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to perform validation before saving the record.
If the validation fails, the record will not be inserted into the database.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$attributeNames</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>List of attribute names that need to be saved. Defaults to null,
meaning all attributes that are loaded from DB will be saved.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$options</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Options given in this parameter are passed to elasticsearch
as request URI parameters. These are among others:</p>
<ul>
<li><code>routing</code> define shard placement of this record.</li>
<li><code>parent</code> by giving the primaryKey of another record this defines a parent-child relation</li>
<li><code>timeout</code> timeout waiting for a shard to become available.</li>
<li><code>replication</code> the replication type for the delete/index operation (sync or async).</li>
<li><code>consistency</code> the write consistency of the index/delete operation.</li>
<li><code>refresh</code> refresh the relevant primary and replica shards (not the whole index) immediately after the operation occurs, so that the updated document appears in search results immediately.</li>
<li><code>detect_noop</code> this parameter will become part of the request body and will prevent the index from getting updated when nothing has changed.</li>
</ul>
<p>Please refer to the <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#_parameters_3">elasticsearch documentation</a>
for more details on these options.</p>
<p>The following parameters are Yii specific:</p>
<ul>
<li><p><code>optimistic_locking</code> set this to <code>true</code> to enable optimistic locking, avoid updating when the record has changed since it
has been loaded from the database. Yii will set the <code>version</code> parameter to the value stored in <span class="broken-link">\yii\elasticsearch\version</span>.
See the <a href="http://www.elastic.co/guide/en/elasticsearch/guide/current/optimistic-concurrency-control.html">elasticsearch documentation</a> for details.</p>
<p>Make sure the record has been fetched with a <span class="broken-link">\yii\elasticsearch\version</span> before. This is only the case
for records fetched via <a href="yii-elasticsearch-activerecord.html#get()-detail">get()</a> and <a href="yii-elasticsearch-activerecord.html#mget()-detail">mget()</a> by default. For normal queries, the <code>_version</code> field has to be fetched explicitly.</p>
</li>
</ul>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>The number of rows affected, or false if validation fails
or <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a> stops the updating process.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-db-staleobjectexception.html">yii\db\StaleObjectException</a></td>
                  <td class="param-desc-col"><p>if optimistic locking is enabled and the data being updated is outdated.</p>
</td>
                </tr>
                            <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-base-invalidparamexception.html">yii\base\InvalidParamException</a></td>
                  <td class="param-desc-col"><p>if no <span class="broken-link">\yii\elasticsearch\version</span> is available and optimistic locking is enabled.</p>
</td>
                </tr>
                            <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-elasticsearch-exception.html">yii\elasticsearch\Exception</a></td>
                  <td class="param-desc-col"><p>in case update failed.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="updateAll()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#updateAll()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L602" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L602" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        updateAll()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Updates all records whos primary keys are given.</strong></p>

        <p>For example, to change the status to be 1 for all customers whose status is 2:</p>
<pre><code class="hljs css"><span class="hljs-rule"><span class="hljs-attribute">Customer</span>:<span class="hljs-value">:<span class="hljs-function">updateAll</span>([<span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">1</span>], [<span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">2</span>])</span></span>;
</code></pre>

        <p>See also [[<a href="yii-elasticsearch-activerecord.html#primaryKeysByCondition()-detail">yii\elasticsearch\ActiveRecord::primaryKeysByCondition()</a>]].</p>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <strong><a href="yii-elasticsearch-activerecord.html#updateAll()-detail">updateAll</a></strong> ( <span style="color: #0000BB">$attributes</span>, <span style="color: #0000BB">$condition&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$attributes</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Attribute values (name-value pairs) to be saved into the table</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The conditions that will be passed to the <code>where()</code> method when building the query.
Please refer to <a href="yii-db-querytrait.html#where()-detail">yii\elasticsearch\ActiveQuery::where()</a> on how to specify this parameter.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The number of rows updated</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-elasticsearch-exception.html">yii\elasticsearch\Exception</a></td>
                  <td class="param-desc-col"><p>on error.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="updateAllCounters()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#updateAllCounters()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L650" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L650" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        updateAllCounters()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Updates all matching records using the provided counter changes and conditions.</strong></p>

        <p>For example, to add 1 to age of all customers whose status is 2,</p>
<pre><code class="hljs css"><span class="hljs-rule"><span class="hljs-attribute">Customer</span>:<span class="hljs-value">:<span class="hljs-function">updateAllCounters</span>([<span class="hljs-string">'age'</span> =&gt; <span class="hljs-number">1</span>], [<span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">2</span>])</span></span>;
</code></pre>

        <p>See also [[<a href="yii-elasticsearch-activerecord.html#primaryKeysByCondition()-detail">yii\elasticsearch\ActiveRecord::primaryKeysByCondition()</a>]].</p>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <strong><a href="yii-elasticsearch-activerecord.html#updateAllCounters()-detail">updateAllCounters</a></strong> ( <span style="color: #0000BB">$counters</span>, <span style="color: #0000BB">$condition&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$counters</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The counters to be updated (attribute name =&gt; increment value).
Use negative values if you want to decrement the counters.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The conditions that will be passed to the <code>where()</code> method when building the query.
Please refer to <a href="yii-db-querytrait.html#where()-detail">yii\elasticsearch\ActiveQuery::where()</a> on how to specify this parameter.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The number of rows updated</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-elasticsearch-exception.html">yii\elasticsearch\Exception</a></td>
                  <td class="param-desc-col"><p>on error.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="updateInternal()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-elasticsearch-activerecord.html#updateInternal()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2-elasticsearch/edit/master/ActiveRecord.php#L506" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2-elasticsearch/blob/master/ActiveRecord.php#L506" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        updateInternal()
        <span class="detail-header-tag small">
            protected                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong></strong></p>

        
        <p>See also <a href="yii-elasticsearch-activerecord.html#update()-detail">update()</a>.</p>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">protected</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-elasticsearch-activerecord.html#updateInternal()-detail">updateInternal</a></strong> ( <span style="color: #0000BB">$attributes&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span>, <span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$attributes</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Attributes to update</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$options</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Options given in this parameter are passed to elasticsearch
as request URI parameters. See <a href="yii-elasticsearch-activerecord.html#update()-detail">update()</a> for details.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>The number of rows affected, or false if validation fails
or <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a> stops the updating process.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-db-staleobjectexception.html">yii\db\StaleObjectException</a></td>
                  <td class="param-desc-col"><p>if optimistic locking is enabled and the data being updated is outdated.</p>
</td>
                </tr>
                            <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-base-invalidparamexception.html">yii\base\InvalidParamException</a></td>
                  <td class="param-desc-col"><p>if no <span class="broken-link">\yii\elasticsearch\version</span> is available and optimistic locking is enabled.</p>
</td>
                </tr>
                            <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-elasticsearch-exception.html">yii\elasticsearch\Exception</a></td>
                  <td class="param-desc-col"><p>in case update failed.</p>
</td>
                </tr>
                        </table>

<!--	-->
</div>
        </div>
</div>

<script type="text/javascript">
    /*<![CDATA[*/
    $("a.toggle").on('click', function () {
        var $this = $(this);
        if ($this.hasClass('properties-hidden')) {
            $this.text($this.text().replace(/Show/,'Hide'));
            $this.parents(".summary").find(".inherited").show();
            $this.removeClass('properties-hidden');
        } else {
            $this.text($this.text().replace(/Hide/,'Show'));
            $this.parents(".summary").find(".inherited").hide();
            $this.addClass('properties-hidden');
        }

        return false;
    });
    /*
     $(".sourceCode a.show").toggle(function () {
     $(this).text($(this).text().replace(/show/,'hide'));
     $(this).parents(".sourceCode").find("div.code").show();
     },function () {
     $(this).text($(this).text().replace(/hide/,'show'));
     $(this).parents(".sourceCode").find("div.code").hide();
     });
     $("a.sourceLink").click(function () {
     $(this).attr('target','_blank');
     });
     */
    /*]]>*/
</script>


</div>

<footer class="footer">
        <p class="pull-right"><small>Page generated on Sat, 09 Jul 2016 12:15:55 +0000</small></p>
    Powered by <a href="http://www.yiiframework.com/" rel="external">Yii Framework</a></footer>

<script type="text/javascript">jQuery(document).ready(function () {
    var shiftWindow = function () { scrollBy(0, -50) };
    if (location.hash) setTimeout(shiftWindow, 1);
    window.addEventListener("hashchange", shiftWindow);
var element = document.createElement("script");
element.src = "./jssearch.index.js";
document.body.appendChild(element);

var searchBox = $('#searchbox');

// search when typing in search field
searchBox.on("keyup", function(event) {
    var query = $(this).val();

    if (query == '' || event.which == 27) {
        $('#search-resultbox').hide();
        return;
    } else if (event.which == 13) {
        var selectedLink = $('#search-resultbox a.selected');
        if (selectedLink.length != 0) {
            document.location = selectedLink.attr('href');
            return;
        }
    } else if (event.which == 38 || event.which == 40) {
        $('#search-resultbox').show();

        var selected = $('#search-resultbox a.selected');
        if (selected.length == 0) {
            $('#search-results').find('a').first().addClass('selected');
        } else {
            var next;
            if (event.which == 40) {
                next = selected.parent().next().find('a').first();
            } else {
                next = selected.parent().prev().find('a').first();
            }
            if (next.length != 0) {
                var resultbox = $('#search-results');
                var position = next.position();

//              TODO scrolling is buggy and jumps around
//                resultbox.scrollTop(Math.floor(position.top));
//                console.log(position.top);

                selected.removeClass('selected');
                next.addClass('selected');
            }
        }

        return;
    }
    $('#search-resultbox').show();
    $('#search-results').html('<li><span class="no-results">No results</span></li>');

    var result = jssearch.search(query);

    if (result.length > 0) {
        var i = 0;
        var resHtml = '';

        for (var key in result) {
            if (i++ > 20) {
                break;
            }
            resHtml = resHtml +
            '<li><a href="' + result[key].file.u.substr(3) +'"><span class="title">' + result[key].file.t + '</span>' +
            '<span class="description">' + result[key].file.d + '</span></a></li>';
        }
        $('#search-results').html(resHtml);
    }
});

// hide the search results on ESC
$(document).on("keyup", function(event) { if (event.which == 27) { $('#search-resultbox').hide(); } });
// hide search results on click to document
$(document).bind('click', function (e) { $('#search-resultbox').hide(); });
// except the following:
searchBox.bind('click', function(e) { e.stopPropagation(); });
$('#search-resultbox').bind('click', function(e) { e.stopPropagation(); });

});</script></body>
</html>
